var win = window;

export const getSiteInfo =  function () {
    var e, t, o, r, i, n, m = document.title,
        u = jQuery('meta[name="description"]').attr("content"), c = jQuery('meta[name="keywords"]').attr("content"),
        d = parseYourubeVideoID(location.href), s = parseBiliBiliVideoID(location.href),
        l = parseVimeoVideoID(location.href), p = jQuery("meta[property='og:video:width']").attr("content"),
        y = jQuery("meta[property='og:video:height']").attr("content");
    if (d) {
        t = d;
        i = "youtube";
        e = `https://i.ytimg.com/vi/${d}/hqdefault.jpg`;
        (n = jQuery(".ytp-time-duration").text()) && hmsToSecondsOnly(n) > 0 && (o = hmsToSecondsOnly(n));
    }
    if (s) {
        t = s;
        i = "bilibili";
        e = jQuery("meta[property='og:image']").attr("content");
        p = jQuery("meta[property='og:width']").attr("content");
        y = jQuery("meta[property='og:height']").attr("content");
        r = "https:" + $(jQuery("#link2").val()).attr("src");
        (n = jQuery(".bilibili-player-video-time-total").text()) && hmsToSecondsOnly(n) > 0 && (o = hmsToSecondsOnly(n))
    }
    if (l) {
        t = l;
        i = "vimeo";
        e = jQuery("meta[property='og:image']").attr("content");
        p = jQuery("meta[property='og:video:width']").attr("content");
        y = jQuery("meta[property='og:video:height']").attr("content");
        (n = jQuery(".vp-progress [aria-valuemax]").attr("aria-valuemax")) && hmsToSecondsOnly(n) > 0 && (o = hmsToSecondsOnly(n))
    }

    var h = {
        metaTitle: m,
        metaDescription: u,
        metaKeywords: c
    };
    return h
}

getSiteInfo();